<template>
    <div class="expert">
        <search-box class="search-view"/>
        <swiper :options="swiperOptions" :auto="2000" :height="165"/>
        <title-label class="bg-white" title="智库专家"/>
        <ul class="list">
            <li v-for="(item, key) in dataList" v-on:click="handleItemClick(item.id)" :key="key">
                <div class="left"><img src="../../assets/expert1.png" /></div>
                <div class="right">
                    <div>{{item.name}}</div>
                    <div><b>公司: </b><span>{{item.company}}</span></div>
                    <div><b>职位: </b><span>{{item.job}}</span></div>
                    <div><b>专家简介: </b><span>{{item.expertsampledesc}}</span></div>
                </div>
            </li>
        </ul>
    </div>
</template>
<style lang="less" scoped>
    @import '../../style/variable';
    .expert {
        .list {
            padding-left: 1.5rem;
            background-color: @color-white;
            li {
                background-color: @color-white;
                display: flex;
                border-bottom: 1px solid rgba(0, 0, 0, 0.1);
                padding: 1.3rem 1.9rem 1.4rem 0;
                .left {
                    width: 4rem;
                    height: 4rem;
                    img {
                        display: block;
                        height: 100%;
                    }
                    margin-right: 1rem;
                }
                .right {
                    color: #333E48;
                    font-size: 1.2rem;
                    b {
                        font-weight: 400;
                        color: #7a7a7a;
                    }
                    div:nth-of-type(1){
                        margin-bottom: 0.7rem;
                    }
                    div:nth-of-type(2){
                        margin-bottom: 0.5rem;
                    }
                    div:nth-of-type(3){
                        margin-bottom: 0.4rem;
                    }
                }
            }
        }
    }
</style>
<script>
    import { Swipe, SwipeItem } from 'vant';
    import { think as API } from 'api';
    import T from 'utils/T';
    export default {
        components: {
            [Swipe.name]: Swipe,
            [SwipeItem.name]: SwipeItem,
        },
        data() {
            return {
                swiperOptions: [
                    {
                        src: 'https://img.yzcdn.cn/public_files/2017/10/24/e5a5a02309a41f9f5def56684808d9ae.jpeg',
                        to: '/same'
                    },
                    'https://img.yzcdn.cn/public_files/2017/10/24/1791ba14088f9c2be8c610d0a6cc0f93.jpeg'
                ],
                dataList: []
            }
        },
        created(){
            this.requestData();
        },
        methods: {
            handleItemClick(id) {
                this.$router.push('/think/expertDetail?id=' + id);
            },
            requestData(){
                this.$axios.get(API.THINK_SPECIALIST).then((result)=>{
                    let resultData = result.data.list;
                    this.dataList = resultData.map((item, key) => {
                        return {
                            id: item.id,
                            name: item.name,
                            company: item.company,
                            job: item.job,
                            expertsampledesc: item.expertsampledesc || '无数据'
                        }
                    });
                    console.log('resultData', resultData);
                })
            },
        }
    }
</script>